//
//  MovieListTableViewCell.m
//  UI-豆瓣项目APP
//
//  Created by dllo on 15/9/8.
//  Copyright (c) 2015年 孙鹏. All rights reserved.
//

#import "MovieListTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation MovieListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self ) {
        
        
        [self creatSubviews];
        
        
    }
    
    return self;
}



- (void)creatSubviews
{
    
    UIImageView *imageView =[[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 360, 125)];
    [imageView setImage:[UIImage imageNamed:@"bg_eventlistcell.png"]];
    [self.contentView addSubview:imageView];
    
    
    self.headImage = [[UIImageView alloc]initWithFrame:CGRectMake(20, 15, 90, 115)];
    [self addSubview:self.headImage];
    self.headImage.backgroundColor = [UIColor yellowColor];
    [_headImage release];
    
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(115, 40, 200, 50)];
    [self addSubview:self.name];
    [_name release];
    
}


-(void)setAmovie:(Movielist *)amovie
{
    
    if (_amovie != amovie) {
        
        [_amovie release];
        _amovie = [amovie retain];
        
        
    }
    
    self.name.text = _amovie.movieName;

    NSURL *url = [NSURL URLWithString:self.amovie.pic_url];
    
    [self.headImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHoderImage"]];

    
    
}

- (void)awakeFromNib {
    // Initialization code
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
